#!usr/bin/env python  
# -*- coding:utf-8 -*-
""" 
@author:robot
@file: title07预定酒店.py 
@version:
@time: 2023/06/01 
"""
n, k, x = map(int, input().split())
prices = list(map(int, input().split()))


def solve_method(prices, n, k, x):
    prices.sort()
    price_rating = [[0, 0] for i in range(n)]
    for i in range(n):
        price = prices[i]
        price_rating[i][0] = price
        # price_rating 第二位存放差值绝对值
        price_rating[i][1] = abs(price - x)

    # 通过差值排序
    sorted_list = sorted(
        price_rating,
        key=lambda h: h[1]
    )

    # 将排序后的价格放入结果
    res = []
    for i in range(k):
        res.append(sorted_list[i][0])
    res.sort()

    for i in range(len(res)):
        print(res[i], end=' ')


solve_method(prices, n, k, x)
